<script setup lang="ts">
import {useRouter} from "vue-router";

let router = useRouter();

function toB() {
  // console.log(useRouter)
  router.push({
    /* path: '/pageB',
     query: {
       id: 103
     }*/
    name: 'pageB',
    params: {
      id: 103
    }
  })
}
</script>

<template>
  pageA
  <!--  <router-link to="/pageB">toB</router-link>-->
  <!--  1.声明式-->
  <!--  <router-link :to="{path:'/pageB',query:{id:103,key:'free'}}">toB</router-link>-->
  <!--  <router-link :to="{name:'pageB',params:{id:103}}">toB</router-link>-->
  <!--  2.函数式-->
  <button @click="toB">toB</button>
</template>

<style scoped>

</style>
